package com.y.architecture.weather;


import com.y.architecture.base_net.ApiCallback;
import com.y.architecture.base_net.BaseNetService;

import rx.Observable;

/**
 * Created by youjingjing on 2017/11/22.
 */

public class WeatherService extends BaseNetService {

   private static WeatherService weatherService;

    public static WeatherService getInstance() {
        if (weatherService == null) {
            synchronized (WeatherService.class){
                if (weatherService == null) {
                    weatherService = new WeatherService();
                }
            }
        }
        return weatherService;
    }

    public void getData(String city, ApiCallback<Weather> callback) {
        Observable<Weather> weather = WeatherNet.getInstance().getmDefaultApi().getWeather(city);
        addCompositeSub(addScheduels(weather).subscribe(callback));
    }
}
